version 14.2
set more off
set matsize 11000

***************************************************************************************************
* THIS ROUTINE GENERATES TABLE A.I OF WASEEM (2019) RESTAT
***************************************************************************************************

/* TABLE */

#d				;
matrix 			input table=(0,0,0,0,0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0,0,0,0,0\
							 0,0,0,0,0,0,0,0,0,0,0,0\0,0,0,0,0,0,0,0,0,0,0,0);
#d				cr

/* RUNNING THE REGRESSION */

use				"$project_data\ExemptionCutoff_06_11.dta",clear
keep			if treat==1
xtset			regnor year
g				filer0=1
g				filer1=F1.filer
replace			filer1=0 if filer1==.
g				tozero=((taxableinc<=300000 & year==2009) | (taxableinc<=350000 & year==2010))
g				placebo=(taxableinc<=300000 & year==2008)
qui				reg filer1 tozero if year<=2010, cluster(regnor)
local			i=1
local			j=1
matrix			table[`i',`j']=_b[tozero]
matrix			table[`i'+1,`j']=_se[tozero]
local			i=`i'+4
matrix			table[`i',`j']=_b[_cons]
matrix			table[`i'+1,`j']=_se[_cons]
matrix 			table[`i'+2,`j']=e(N)
local			j=`j'+1
qui				reg filer1 placebo if year<=2010, cluster(regnor)
local			i=3
matrix			table[`i',`j']=_b[placebo]
matrix			table[`i'+1,`j']=_se[placebo]
local			i=`i'+2
matrix			table[`i',`j']=_b[_cons]
matrix			table[`i'+1,`j']=_se[_cons]
matrix 			table[`i'+2,`j']=e(N)
local			j=`j'+1


use				"$project_data\BSP_Incfrsalary_Robust.dta",clear
keep			if employee==1
xtset			regnor year
g				filer0=1
g				filer1=F1.filer
replace			filer1=0 if filer1==.
g				tozero=0
replace			tozero=1 if taxableinc>150000 & taxableinc<180000 & year==2007
replace			tozero=1 if taxableinc>180000 & taxableinc<200000 & year==2008
replace			tozero=1 if taxableinc>200000 & taxableinc<300000 & year==2009
replace			tozero=1 if taxableinc>300000 & taxableinc<350000 & year==2010
g				placebo=0
replace			placebo=1 if taxableinc>150000 & taxableinc<180000 & year==2006
replace			placebo=1 if taxableinc>180000 & taxableinc<200000 & year==2007
replace			placebo=1 if taxableinc>200000 & taxableinc<300000 & year==2008
replace			placebo=1 if taxableinc>300000 & taxableinc<350000 & year==2009
qui				reg filer1 tozero if year<=2010, cluster(regnor)
local			i=1
matrix			table[`i',`j']=_b[tozero]
matrix			table[`i'+1,`j']=_se[tozero]
local			i=`i'+4
matrix			table[`i',`j']=_b[_cons]
matrix			table[`i'+1,`j']=_se[_cons]
matrix 			table[`i'+2,`j']=e(N)
local			j=`j'+1
qui				reg filer1 placebo if year<=2010, cluster(regnor)
local			i=3
matrix			table[`i',`j']=_b[placebo]
matrix			table[`i'+1,`j']=_se[placebo]
local			i=`i'+2
matrix			table[`i',`j']=_b[_cons]
matrix			table[`i'+1,`j']=_se[_cons]
matrix 			table[`i'+2,`j']=e(N)
local			j=`j'+1

/* FORMATTING TABLE */

svmat 			table
keep			tab*
drop			table5-table12
keep			if _n<=7
forvalues		c=1/4 {
				g c`c'=string(table`c',"%9.3f")
}
forvalues		r=2(2)6 {
forvalues		c=1/4 {
replace			c`c'="("+string(table`c',"%9.3f")+")" in `r'
}
}
forvalues		c=1/4 {
replace			c`c'=string(table`c',"%9.0fc") in 7
}
foreach			c in 1 3 {
forvalues		r=3/4 {
replace			c`c'="" in `r'
}
}
foreach			c in 2 4 {
forvalues		r=1/2 {
replace			c`c'="" in `r'
}
}
g				ci="" 
replace			ci="$\mbox{\emph{to-zero}}_{it}$" in 1
replace			ci="$\mbox{\emph{placebo}}_{it}$" in 3
replace			ci="Constant" in 5
replace			ci="Observations" in 7
forvalues		s=1/12 {
g				s`s'="&"
}
g				l="\\"
browse			ci s12 c1 s1 c2 s2 s11 c3 s3 c4 l

